/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package cl.bussines.entities;

import java.io.Serializable;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author Vogel
 */
@Entity
@Table(name = "sucu_prod")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "SucuProd.findAll", query = "SELECT s FROM SucuProd s"),
    @NamedQuery(name = "SucuProd.findByIdSucuProd", query = "SELECT s FROM SucuProd s WHERE s.idSucuProd = :idSucuProd")})
public class SucuProd implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "id_Sucu_Prod")
    private Integer idSucuProd;
    @JoinColumn(name = "id_Sucursales", referencedColumnName = "id_Sucursales")
    @ManyToOne(optional = false)
    private Sucursales idSucursales;
    @JoinColumn(name = "Cod_Prod", referencedColumnName = "Cod_Prod")
    @ManyToOne(optional = false)
    private Productos codProd;

    public SucuProd() {
    }

    public SucuProd(Integer idSucuProd) {
        this.idSucuProd = idSucuProd;
    }

    public Integer getIdSucuProd() {
        return idSucuProd;
    }

    public void setIdSucuProd(Integer idSucuProd) {
        this.idSucuProd = idSucuProd;
    }

    public Sucursales getIdSucursales() {
        return idSucursales;
    }

    public void setIdSucursales(Sucursales idSucursales) {
        this.idSucursales = idSucursales;
    }

    public Productos getCodProd() {
        return codProd;
    }

    public void setCodProd(Productos codProd) {
        this.codProd = codProd;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idSucuProd != null ? idSucuProd.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof SucuProd)) {
            return false;
        }
        SucuProd other = (SucuProd) object;
        if ((this.idSucuProd == null && other.idSucuProd != null) || (this.idSucuProd != null && !this.idSucuProd.equals(other.idSucuProd))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "cl.bussines.entities.SucuProd[ idSucuProd=" + idSucuProd + " ]";
    }
    
}
